package com.tingyuge.base.thread.wang.chapter6;

public class ThreadInterrupt {
    public static void main(String[] args) throws InterruptedException {

       final Thread t1 = new Thread(()->{
            while (true) {
                try {
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    System.out.println("收到打断信号");

                    e.printStackTrace();
                    break;
                }

            }
        });
        t1.start();
        Thread.sleep(1000);
        System.out.println(t1.isInterrupted());
        t1.interrupt();
        System.out.println(t1.isInterrupted());
    }
}
